home *** CD-ROM | disk | FTP | other *** search
/ MacWorld 1998 September / Macworld (1998-09).dmg / Shareware World / Info / For Developers / MacZoop 1.8.3 / More Classes / Threads / ZThreadedApplication.cpp < prev    next >
Text File  |  1997-12-24  |  1KB  |  63 lines

  1. /*************************************************************************************************
  2. *
  3. *
  4. *            ObjectMacZapp        -- a standard Mac OOP application template
  5. *
  6. *
  7. *
  8. *            ZThreadedApplication.cpp            -- the threaded application object
  9. *
  10. *
  11. *
  12. *
  13. *
  14. *            © 1996, Graham Cox
  15. *
  16. *
  17. *
  18. *
  19. *************************************************************************************************/
  20.  
  21.  
  22. #include    "ZThreadedApplication.h"
  23. #include    <Threads.h>
  24.  
  25.  
  26. Boolean        gMacHasThreadManager = FALSE;
  27.  
  28.  
  29. void    ZThreadedApplication::InitMacZoop( const short numMasterBlocks )
  30. {
  31.     OSErr    theErr;
  32.     long    tmFeatures;
  33.     
  34.     theErr = Gestalt(gestaltThreadMgrAttr, &tmFeatures);
  35.     
  36.     gMacHasThreadManager = ((theErr == noErr) && (tmFeatures & 1));
  37.     
  38.     // see if threads lib is linked on Powermac
  39.     
  40.     #ifdef __powerc
  41.     
  42.     if (gMacHasThreadManager)
  43.         gMacHasThreadManager = ( YieldToAnyThread != (void*) kUnresolvedCFragSymbolAddress );    
  44.     
  45.     #endif
  46.     
  47.     ZApplication::InitMacZoop( numMasterBlocks );
  48. }
  49.  
  50.  
  51.  
  52. void    ZThreadedApplication::Process1Event()
  53. {
  54.     ZApplication::Process1Event();
  55.  
  56.     // if we have the thread manager, yield to any thread
  57.     
  58.     if ( gMacHasThreadManager )
  59.         YieldToAnyThread();
  60. }
  61.  
  62.  
  63.